package com.reformer.commons.constant;


//状态(0:免费1:超时2:已缴费3:续费4:未付款5逃费-1误操作)
public enum ParkingRecordStatus {
    /**
     * 误操作，离场
     */
    END_OF_ERROPERATE(-1, "误操作"),
    /**
     * 免费，离场
     */
    END_OF_FREE(0, "免费"),
    TIMEOUT(1, "超时"),
    /**
     * 正常离场
     */
    END_OF_NORMAL(2, "已缴费"),
    /**
     * 缴费未离场
     */
    PAID(3, "续费"),
    /**
     * 未付款，正在停车
     */
    PARKING(4, "未付款"),
    /**
     * 欠费离场
     */
    END_OF_ARREAR(5, "逃费");

    private int status;
    private String desc;

    ParkingRecordStatus(int status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    /**
     * 根据状态值查询
     *
     * @param status
     * @return
     */
    public static ParkingRecordStatus findByStatus(int status) {
        for (ParkingRecordStatus parkingRecordStatus : ParkingRecordStatus.values()) {
            if(parkingRecordStatus.getStatus() == status){
                return parkingRecordStatus;
            }
        }
        return null;
    }

    public int getStatus() {
        return status;
    }

    public String getDesc() {
        return desc;
    }
}
